//
//  LOLEquipCollectionCell.m
//  LOLXXbox
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLEquipCollectionCell.h"
#import <UIImageView+WebCache.h>
#import <Masonry.h>
@implementation LOLEquipCollectionCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        [self addSubview:self.imageViews];
        
        self.label = [[UILabel alloc] init];
        self.label.font = [UIFont systemFontOfSize:15];
        self.label.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.label];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{

    [self.imageViews mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(5);
        make.left.equalTo(self.contentView).offset(5);
        make.right.equalTo(self.contentView).offset(-5);
        make.bottom.equalTo(self.contentView).offset(-30);
    }];
    
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView).offset(-5);
        make.left.equalTo(self.contentView).offset(5);
        make.right.equalTo(self.contentView).offset(-5);
        make.top.equalTo(self.imageViews.mas_bottom).offset(5);
    }];

}
- (void)setNextModel:(LOLEquipNextModel *)nextModel{
    _nextModel = nextModel;
    self.label.text = _nextModel.text;
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://img.lolbox.duowan.com/zb/%@_64x64.png", _nextModel.myId]]];
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
